#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 1005;
const int M = 15005;
const int INF = 1e9;

int n, m, k;
int U[105], V[105];
int head[N];
int ver[M], W[M], Next[M], tot;
void addedge(int u, int v, int w) {
  ++tot;
  ver[tot] = v;
  W[tot] = w;
  Next[tot] = head[u];
  head[u] = tot;
}
void add(int u, int v, int w) {
  addedge(u, v, w);
  addedge(v, u, 0);
}
int dep[N], s, t;
bool bfs() {
  rep(i, 1, t) dep[i] = 0;
  queue<int> q;
  q.push(s);
  dep[s] = 1;
  while (q.size()) {
    int u = q.front();
    q.pop();
    for (int i = head[u]; i; i = Next[i]) {
      int v = ver[i];
      int w = W[i];
      if (w && !dep[v]) {
        dep[v] = dep[u] + 1;
        q.push(v);
      }
    }
  }
  return dep[t];
}
int dfs(int u, int in) {
  if (u == t) return in;
  int out = 0;
  for (int i = head[u]; i; i = Next[i]) {
    int v = ver[i];
    if (dep[v] == dep[u] + 1 && W[i]) {
      int flow = dfs(v, min(in, W[i]));
      W[i] -= flow;
      W[i ^ 1] += flow;
      in -= flow;
      out += flow;
    }
  }
  if (!out) dep[u] = 0;
  return out;
}
int dinic() {
  int res = 0;
  while (bfs()) {
    res += dfs(s, INF);
    if (res >= INF) break;
  }
  return res;
}
int id(int d, int x) { return (d - 1) * n + x; }
bool check(int d) {
  s = id(1, 1), t = id(d, n);
  rep(i, 1, t) head[i] = 0;
  tot = 1;
  rep(i, 1, d) {
    rep(j, 1, m) {
      int u = id(i, U[j]), v = id(i, V[j]);
      add(u, v, 1);
    }
  }
  rep(i, 1, d - 1) {
    rep(j, 1, m) {
      int u = id(i, U[j]), v = id(i + 1, V[j]);
      add(u, v, INF);
    }
    add(id(i, n), id(i + 1, n), INF);
  }
  return dinic() <= k;
}
int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m >> k;
  rep(i, 1, m) cin >> U[i] >> V[i];
  int l = 1, r = n - 1;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (check(mid))
      l = mid + 1;
    else
      r = mid - 1;
  }
  cout << r;
  return 0;
}